import 'package:flutter/material.dart';
import 'package:flutter_axrjc/widget/count_down_dialog/logic.dart';
import 'package:get/get.dart';

class CountDownDialogView extends StatelessWidget {
  final Duration duration;

  const CountDownDialogView({super.key, required this.duration});

  @override
  Widget build(BuildContext context) {
    return GetBuilder(
      init: CountDownDialogLogic(duration),
      assignId: true,
      builder: (logic) {
        return Material(
          color: Colors.transparent,
          child: Center(
              child: Container(
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(10)),
                  width: Get.width * 0.6,
                  height: Get.width * 0.6,
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Obx(() {
                        return Text(
                          "${logic.countDown.value}",
                          style: const TextStyle(
                              fontWeight: FontWeight.bold, fontSize: 30),
                        );
                      }),
                      const Text("秒后开始检测"),
                    ],
                  ))),
        );
      },
    );
  }
}
